package service1;

import beans1.Adminbean;
import db1.AdminDAO;

import java.sql.SQLException;
import java.util.ArrayList;

public class AdminService {
    public ArrayList<Adminbean> browse(){
        AdminDAO dao =new AdminDAO();
        return  dao.getAllRecords();
    }


    public int delAdmin(Adminbean user)
    {
        AdminDAO userDao=new AdminDAO();
        if(userDao.deleteRecord(user))
            return 1;
        else
            return 2;
    }
    public boolean editAdmin(Adminbean user) throws SQLException {
        AdminDAO userDao=new AdminDAO();
        System.out.println("in editAdmin Service"+user.getAccount());
        if(userDao.editAdmin(user))
            return true;
        else
            return false;
    }

    public boolean insertAdmin(Adminbean user) throws SQLException {
        AdminDAO userDao=new AdminDAO();
        if(userDao.insertAdmin(user))
            return true;
        else
            return false;
    }
}
